<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <div id='app'>
        <h1>DEMO4 </h1>
        <p> {{ message }} </p>
    </div>


    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>

    <script>
        var app = new Vue({
            el: '#app',
            data: {
                message: 'Hello Vue!'
            },

            mounted() {
                this.fetch()
            },

            methods: {
                fetch() {
                    var xhr = new XMLHttpRequest()
                    xhr.open("GET", "/api/demo4.v1/video")
                    xhr.onreadystatechange = () => {
                        if (xhr.readyState != 4) return;
                        if (xhr.status != 200) return;
                        var text = xhr.responseText;
                        var j = JSON.parse(text);
                        console.log("resp:" + text)
                        console.log("resp(JSON):" + j)
                    }
                    xhr.send()
                }
            }
        })
    </script>

</body>

</html>